#ifndef N1DATA_H_2006_10_29
#define N1DATA_H_2006_10_29

#include "N1Object.h"
#include "N1SmartBuffer.h"

class N1Data : public N1Object {
protected:
    N1SmartBuffer m_buffer;

public:
    N1Data();

    virtual ~N1Data();

    N1NAME_DECL;

    N1Data(N1UInt32 capacity);

    N1Data(const void* data, N1UInt32 size);

    void attach(void* data, uint32 size);

    void detach();

    N1UInt32 size() const { return m_buffer.getDataSize(); };

    N1UInt32 realSize() const { return m_buffer.getBufferSize(); };

    void setSize(N1UInt32 newSize);

    void increaseSize(N1UInt32 add);

    const void* bytes() const { return m_buffer.getPtr(); };

    void* bytes() { return m_buffer.getPtr(); };

    void addMemory(const void* ptr, uint32 size);
    void addByte(uint8 b);
    void addShort(uint16 s);
    void addInt(uint32 i);
};

#endif //N1DATA_H_2006_10_29
